{extend name='admin@main'}

{block name="button"}

<!-- {if auth("admin/permission.department/add")}
<button data-modal='{:url("add")}' data-title="添加部门" class='layui-btn layui-btn-sm layui-btn-primary'>添加部门</button>
{/if}

{if auth("admin/permission.department/remove")}
<button data-action='{:url("remove")}' data-rule="id#{key}" class='layui-btn layui-btn-sm layui-btn-primary'>删除部门</button>
{/if} -->

{/block}

{block name="content"}
<div class="think-box-shadow">
    {include file='permission/department/index_search'}
    <div class="layui-obj">
        {if auth("admin/permission.department/add")}
        <button data-modal='{:url("add")}' data-title="添加部门" class='layui-btn layui-btn-sm layui-btn-primary'>添加</button>
        {/if}
        
        {if auth("admin/permission.department/remove")}
        <button data-action='{:url("remove")}' data-rule="id#{key}"  data-confirm="确定要删除这些部门吗？" class='layui-btn layui-btn-sm layui-btn-primary'>删除</button>
        {/if}
     
    </div>
    <table class="layui-table margin-top-0" lay-skin="line">
        {notempty name='list'}
        <thead>
        <tr>
            <th class='list-table-check-td think-checkbox'>
                <input data-auto-none data-check-target='.list-check-box' type='checkbox'>
            </th>
            <th class='list-table-sort-td'>
                <button type="button" data-reload class="layui-btn layui-btn-xs">刷 新</button>
            </th>
            <th class='text-left nowrap'>部门名称</th>          
            <th class="text-center">部门标识</th>
            <th class="text-center">成员数量</th>
            <th class='text-left nowrap'>部门描述</th>
            <th class="text-left">创建时间</th>
            <th></th>
        </tr>
        </thead>
        {/notempty}
        <tbody>
        {foreach $list as $key=>$vo}
        <tr data-dbclick>
            <td class='list-table-check-td think-checkbox'>
                <input class="list-check-box" value='{$vo.id}' type='checkbox'>
            </td>
            <td class='list-table-sort-td'>
                <input data-action-blur="{:request()->url()}" data-value="id#{$vo.id};action#sort;sort#{value}" data-loading="false" value="{$vo.sort}" class="list-sort-input">
            </td>
            <td class='text-left nowrap'>{$vo.dep_title|default=''}</td>           
            <td class='text-center nowrap'>
                <span class="layui-badge layui-bg-green">{$vo.dep_type_cn}</span><br>
            </td>
            <td class='text-center nowrap'>
                {$vo.user_number|default=''}
            </td>
            <td class='text-left nowrap'>{$vo.desc|default=''}</td>
            <td class='text-left nowrap'>日期：{$vo.create_at|format_datetime|str_replace=' ','<br><span class="color-desc">时间：',###|raw}</span></td>
            <td class='text-left nowrap'>
                {if auth("admin/permission.department/edit")}
                <a data-dbclick data-title="编辑部门" class="layui-btn layui-btn-sm" data-modal='{:url("edit")}?id={$vo.id}'>编 辑</a>
                {/if}
                {if auth("admin/permission.department/remove")}
                <a class="layui-btn layui-btn-sm layui-btn-danger" data-confirm="确定要删除数据吗?" data-action="{:url('remove')}" data-value="id#{$vo.id}">删 除</a>
                {/if}
            </td>
        </tr>
        {/foreach}
        </tbody>
    </table>
    {empty name='list'}<span class="notdata">没有记录哦</span>{else}{$pagehtml|raw|default=''}{/empty}
</div>
<style>
    .layui-obj{
        margin-top: 10px!important;
    }
    .layui-tab{
        margin-top: 10px!important;
    }
	.layui-table td, .layui-table th {
		box-sizing: border-box;
	}
</style>
{/block}
